package com.lening.service;

import com.lening.entity.*;
import com.lening.mapper.StuMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 创作时间：2019/8/22 9:46
 * 作者：李增强
 */
@Service
public class StuService {
    @Resource
    StuMapper stuMapper;

    public List<PowerBean> getPowerList() {
        return stuMapper.getPowerList();
    }

    public List<StuBean> getStuList() {

        return stuMapper.getStuList();
    }

    public StuBean getStuById(Integer id) {
        return stuMapper.getStuById(id);
    }

    public List<GradeBean> getGradeList() {
        return stuMapper.getGradeList();
    }

    public void updateStuGrade(Integer id, Integer gid) {
        if(id!=null&&gid!=null){
            stuMapper.updateStuGrade(id,gid);
        }
    }

    public List<TeacherBean> getTeacherList() {
        return stuMapper.getTeacherList();
    }

    public List<RoomBean> getRoomList() {
        return stuMapper.getRoomList();
    }

    public GradeBean getGradeByGid(Integer gid) {
        return stuMapper.getGradeByGid(gid);
    }

    public void updateGradeRoom(Integer gid, Integer rid) {
        stuMapper.updateGradeRoom(gid,rid);
    }

    public TeacherBean getTeacherByTid(Integer tid) {
        return stuMapper.getTeacherByTid(tid);
    }

    public void updateGradeTeacher(Integer gid, Integer tid) {
        stuMapper.updateGradeTeacher(gid,tid);
    }

    public void saveExcel(List<StuBean> list) {
        if(list!=null&&list.size()>=1){
            for (StuBean stuBean : list) {
                stuMapper.insertStu(stuBean);
            }
        }
    }
}
